﻿<%@ Page Language="C#" MasterPageFile="~/Common/Master/FrameMain.master" AutoEventWireup="true" Inherits="Mail_List" Title="无标题页" Codebehind="List.aspx.cs" %>

<%@ Register Src="../../Common/Controls/MailSelecter.ascx" TagName="MailSelecter" TagPrefix="uc1" %>
<%@ Register Src="../../Common/Controls/Pager.ascx" TagName="Pager" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script type="text/javascript" src="../../common/Js/menu.js"></script>

    <script type="text/javascript">
        function GotoDetail(folderID,boxType)
        {   
            window.navigate( "Detail.aspx?FolderID=" + folderID + "&BoxType=" + boxType);
        }
        function SelectMail(status)
        {
            var table = document.getElementById("lvList");
            switch(status)
            {
                case 0://全部
                    for(i=0 ; i<table.rows.length; i++)
                    {                        
                        var chk = table.rows[i].cells[1].getElementsByTagName("INPUT")[0];                        
                        if(!chk.checked)
                        {
                            chk.click();
                        }                        
                    }
                    break;                    
                case 1://未读
                    for(i=1 ; i<table.rows.length; i++)
                    {
                        var status = table.rows[i].cells[0].getElementsByTagName("INPUT")[0].value;                        
                        var chk = table.rows[i].cells[1].getElementsByTagName("INPUT")[0];
                        if(parseInt(status) == 0)
                        {
                            if(!chk.checked)
                            {
                                chk.click();
                            }
                        }
                        else
                        {
                            if(chk.checked)
                            {
                                chk.click();
                            }
                        }
                    }
                    break;
                case 2://已读
                    for(i=1 ; i<table.rows.length; i++)
                    {
                        var status = table.rows[i].cells[0].getElementsByTagName("INPUT")[0].value;
                        var chk = table.rows[i].cells[1].getElementsByTagName("INPUT")[0];
                        if(parseInt(status) != 0)
                        {
                            if(!chk.checked)
                            {
                                chk.click();
                            }
                        }
                        else
                        {
                            if(chk.checked)
                            {
                                chk.click();
                            }
                        }
                    }
                    break;
                case 3://反选
                    for(i=1 ; i<table.rows.length; i++)
                    {                        
                        var chk = table.rows[i].cells[1].getElementsByTagName("INPUT")[0];
                        chk.click();
                    }
                    break;
                case 4://不选
                    for(i=0 ; i<table.rows.length; i++)
                    {                        
                        var chk = table.rows[i].cells[1].getElementsByTagName("INPUT")[0];                        
                        if(chk.checked)
                        {
                            chk.click();
                        }                        
                    }
                    break;
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="toolbar">
        <ul>
            <li><a id="lnkAdd" runat="server" href="javascript:;"><span><b style="background-image: url(../../common/images/Mail/new.gif);">
                &nbsp;</b>
                <asp:Literal ID="Literal1" runat="server" Text="写信"></asp:Literal></span></a></li>
            <li><a id="lnkDelete" runat="server" href="javascript:;"><span><b style="background-image: url(../../common/images/Mail/delete.gif);">
                &nbsp;</b>
                <asp:Literal ID="Literal2" runat="server" Text="删除"></asp:Literal></span></a></li>
            <li>
                <div style="width: 0px; height: 0px; position: absolute;">
                    <div id="divmenu" style="display: none;">
                        <asp:Repeater ID="rptMenu" runat="server" OnItemCommand="rptMenu_ItemCommand">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("ID") %>'><%#Eval("Name") %></asp:LinkButton>
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                </div>
                <a id="lnkMove" href="javascript:showMenu('lnkMove');"><span><b style="background-image: url(../../common/images/Mail/move.gif);">
                    &nbsp;</b><asp:Literal ID="Literal3" runat="server" Text="移动"></asp:Literal></span></a>
            </li>
            <li><a id="lnkRefresh" runat="server" href="javascript:;"><span><b style="background-image: url(../../common/images/Mail/refresh.gif);">
                &nbsp;</b><asp:Literal ID="Literal4" runat="server" Text="刷新"></asp:Literal></span></a>
            </li>
        </ul>
    </div>
    <div id="head">
        <div class="left">
            <asp:Label ID="Label1" runat="server" Text="查看：" Font-Bold="true"></asp:Label><asp:LinkButton
                ID="btnAll" runat="server" Style="color: #999999" OnClick="btnAll_Click">全部</asp:LinkButton>&nbsp;-&nbsp;<asp:LinkButton
                    ID="btnUnRead" runat="server" Style="color: #999999" OnClick="btnUnRead_Click">未读</asp:LinkButton>&nbsp;-&nbsp;<asp:LinkButton
                        ID="btnRead" runat="server" Style="color: #999999" OnClick="btnRead_Click">已读</asp:LinkButton>&nbsp;-&nbsp;<asp:LinkButton
                            ID="btnReply" runat="server" Style="color: #999999" OnClick="btnReply_Click">已回复</asp:LinkButton>&nbsp;-&nbsp;<asp:LinkButton
                                ID="btnForword" runat="server" Style="color: #999999" OnClick="btnForword_Click">已转发</asp:LinkButton>
        </div>
        <div class="right">
            <asp:Label ID="lblBox" runat="server" Text="Label" Font-Bold="true"></asp:Label>[&nbsp;<asp:Label
                ID="lblMessage" runat="server" Text="Label"></asp:Label>&nbsp;]</div>
    </div>
    <asp:Panel ID="pnlStatus" runat="server" Width="100%" CssClass="message" Visible="false">
        <asp:Label ID="Label6" runat="server" Text="当前查看的状态是："></asp:Label>
        <asp:Label ID="lblStatus" runat="server" Text="Label"></asp:Label></asp:Panel>
    <div id="list">
        <asp:HiddenField ID="hidSelectIDs" runat="server" Value="" />
        <table id="lvList" cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr id="lvHeader" runat="server">
                <th class="sp">
                    &nbsp;
                </th>
                <th class="chk">
                    <asp:CheckBox ID="chkSelectAll" runat="server" />
                </th>
                <th class="chk">
                    <asp:Image ID="Image8" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/common/images/Mail/MailHead.gif" />
                </th>
                <th class="chk">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/common/images/Mail/math.gif" />
                </th>
                <th id="thFrom" runat="server">
                    <asp:LinkButton ID="btnCreator" runat="server" CommandArgument="CreatorName">发件人</asp:LinkButton>
                </th>
                <th id="thTo" runat="server">
                    <asp:LinkButton ID="btnReciever" runat="server" CommandArgument="RecieveNames">收件人</asp:LinkButton>
                </th>
                <th>
                    <asp:LinkButton ID="btnName" runat="server" CommandArgument="Name">主题</asp:LinkButton>
                </th>
                <th class="last">
                    <asp:LinkButton ID="btnInputTime" runat="server" CommandArgument="InputTime">日期</asp:LinkButton>
                </th>
            </tr>
            <asp:ListView ID="lv" runat="server" ItemPlaceholderID="items" OnItemDataBound="lv_ItemDataBound">
                <LayoutTemplate>
                    <tr id="items" runat="server">
                    </tr>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr id="row" runat="server">
                        <td class="sp">
                            <asp:HiddenField ID="hidStatus" runat="server" Value='<%# Eval("Status") %>' />
                            &nbsp;
                        </td>
                        <td class="chk">
                            <asp:CheckBox ID="chkSelect" runat="server" />
                        </td>
                        <td class="chk">
                            <asp:Image ID="Image2" runat="server" ImageAlign="AbsMiddle" ImageUrl='<%# Eval("MailFlag") %>' />
                        </td>
                        <td class="chk">
                            <asp:Literal ID="Literal1" runat="server" Text="&nbsp;" Visible='<%# !DispAttach(Eval("AttachCount")) %>'></asp:Literal><asp:Image
                                ID="Image3" runat="server" ImageUrl="~/common/images/Mail/math.gif" ToolTip='<%# Eval("AttachCount") + "个附件" %>'
                                Visible='<%# DispAttach(Eval("AttachCount")) %>' />
                        </td>
                        <td id="tdFrom" runat="server">
                            <%#Eval("CreatorName") %>
                        </td>
                        <td id="tdTo" runat="server">
                            <%#Eval("RecieveNames")%>
                        </td>
                        <td>
                            <asp:HyperLink ID="lnkName" runat="server" NavigateUrl='<%#"Detail.aspx?FolderID=" + FolderID + "&MailUserID=" + Server.UrlEncode(Eval("ID").ToString()) %>'><%# Eval("Name") %></asp:HyperLink>
                        </td>
                        <td>
                            <%# Eval("InputTime") %>
                        </td>
                    </tr>
                </ItemTemplate>
                <EmptyDataTemplate>
                    <tr>
                        <td colspan="8" class="empty">
                            没有邮件
                        </td>
                    </tr>
                </EmptyDataTemplate>
            </asp:ListView>
        </table>
    </div>
    <div id="foot">
        <uc1:MailSelecter ID="MailSelecter1" runat="server" />
        <uc2:Pager ID="Pager1" runat="server" />
    </div>
    <div id="toolbar_bottom">
        <asp:Button ID="btnDelete" runat="server" Text="删除" OnClick="btnDelete_Click" CausesValidation="False" />
        <asp:Button ID="btnRefresh" runat="server" Text="刷新" OnClick="btnRefresh_Click" />
    </div>
</asp:Content>
